Tables Function:
Returns an array of all table names in a database.
Description:
The Tables Function returns an array of all table names in a database. There is one required argument, connstring which must be a valid OLE database connection string.
Syntax:
array = Tables(connstring)
Example:
<%
dim i, ar, cn
cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath ("/database/mydata.mdb") & ";"
ar = Tables(cn)
for i = 0 to ubound(ar) - 1 '--- write each table name to the browser response.write ar(i) & "<BR>" next
%>
ASP Source Code:
<%
Private Function Tables(byval connstring) Dim adox, i, strTables Set adox = Server.CreateObject("ADOX.Catalog") adox.ActiveConnection = connstring for i = 0 to adox.tables.count - 1 if UCase( adox.tables(i).type ) = "TABLE" then strTables = strTables & adox.tables(i).name & vbCrLf end if next Set adox = nothing Tables = split( strTables, vbCrLf ) End Function '--- Tables
%>
|